﻿using Sumc.Client.ModernUI.Common;
using Sumc.Models.Responses;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Sumc.Client.ModernUI.Services
{
    public class NewsRepository : BaseRepository, INewsRepository
    {
        public NewsRepository()
        {
            this.expireTime = new TimeSpan(3, 0, 0);
        }

        public async Task<IEnumerable<NewsGlanceInformation>> GetNews()
        {
            var url = string.Format("{0}News", Constants.BaseSumcApiUrl);
            var news = await this.Get<IEnumerable<NewsGlanceInformation>>(url);
            return news;
        }

        public async Task<News> GetNews(string id)
        {
            var url = string.Format("{0}News?id={1}", Constants.BaseSumcApiUrl, id);
            var news = await this.Get<News>(url);
            return news;
        }
    }
}
